package com.changwu.cwbase.ui.dialog;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;

import com.changwu.cwbase.R;
import com.changwu.cwbase.base.BasicDialog;


/**
 * @date:2017/2/16
 * @author: 魏寿明
 * @description:
 */

public class CommonDialog extends BasicDialog implements View.OnClickListener {
    // dialog监听控件
    public CommonDialog(Context context) {
        super(context);
        setContentView(R.layout.dialog_common);
        getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
//        getWindow().setGravity(Gravity.BOTTOM);
        this.context = context;
        init();
    }

    private void init() {
        cancel = (Button) findViewById(R.id.cancel);
        submit = (Button) findViewById(R.id.submit);
        submit.setOnClickListener(this);
        cancel.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        if (listener != null) {
            switch (v.getId()) {
                case R.id.submit:
                    if (listener != null) {
//                        data.put(CConstants.LIST_MEMBERBEAN, datas);
                        listener.submit(data);
                    }
                    dismiss();
                    break;
                case R.id.cancel:
                    dismiss();
                    break;
            }
        }
    }

}
